/*
 * 创建日期 2009-3-17
 *
 * 成都天和软件公司
 * 电话：028-85425861
 * 传真：028-85425861-8008
 * 邮编：610041 
 * 版权所有
 */
package  org.fantasy.common.grid.tag;

import java.io.Writer;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;

/**
 *  AbstractTag
 * @author: 王文成
 * @version: 1.0
 * @since 2009-3-17
 */
public class AbstractTag extends TagSupport {
    
    @Override
    public void setPageContext(PageContext pageContext) {
        super.setPageContext(pageContext);
        this.init();
    }

    protected void init() {
        // will do
    }
    
    protected String getCtx() {
        return getRequest().getContextPath();
    }

    protected Writer getWriter() {
        return pageContext.getOut();
    }

    protected HttpServletRequest getRequest() {
        return (HttpServletRequest) pageContext.getRequest();
    }

    protected HttpServletResponse getResponse() {
        return (HttpServletResponse) pageContext.getResponse();
    }

    protected HttpSession getSession() {
        return (HttpSession) pageContext.getSession();
    }

    protected ServletContext getServletContext() {
        return (ServletContext) pageContext.getServletContext();
    }
}
